package com.meixiang.util;

import android.util.SparseArray;

import com.meixiang.entity.shopping.GoodsMenuItemEntity;
import com.meixiang.entity.shopping.GoodsTypeEntity;
import com.meixiang.entity.shopping.StoreEntity;
import com.meixiang.entity.shopping.result.MallMainResult.BrandListEntity;

import java.util.ArrayList;
import java.util.List;

/**
 * 商品页面菜单列表数据
 *
 * @author LZRUI
 */
public class GoodsMenuDataUtil {

    public static SparseArray<GoodsMenuItemEntity> typeMenuList = new SparseArray<>();
    public static SparseArray<GoodsMenuItemEntity> storeMenuList = new SparseArray<>();
    public static SparseArray<GoodsMenuItemEntity> brandMenuList = new SparseArray<>();

    public static void setTypeList(List<GoodsTypeEntity> typeList) {
        if (typeList == null)
            return;
        int len = typeList.size();
        for (int i = 0; i < len; i++) {
            GoodsTypeEntity type = typeList.get(i);
            GoodsMenuItemEntity bean = new GoodsMenuItemEntity(type.getGcId(), type.getGcName(), type.getGcCount());
            typeMenuList.put(i, bean);
        }
    }

    public static SparseArray<GoodsMenuItemEntity> getTypeList() {
        return typeMenuList;
    }

    public static void setStoreList(List<StoreEntity> storeList) {
        if (storeList == null)
            return;
        int len = storeList.size();
        for (int i = 0; i < len; i++) {
            StoreEntity store = storeList.get(i);
            GoodsMenuItemEntity bean = new GoodsMenuItemEntity(store.getStoreId(), store.getStoreName(), store.getGoodsCount());
            storeMenuList.put(i, bean);
        }
    }

    public static SparseArray<GoodsMenuItemEntity> getStoreList() {
        return storeMenuList;
    }

    public static void setBrandMenuList(List<BrandListEntity> storeList) {
        if (storeList == null)
            return;
        int len = storeList.size();
        for (int i = 0; i < len; i++) {
            BrandListEntity store = storeList.get(i);
            GoodsMenuItemEntity bean = new GoodsMenuItemEntity(store.getBrandId(), store.getBrandName(), store.getBrandCount());
            brandMenuList.put(i, bean);
        }
    }

    public static SparseArray<GoodsMenuItemEntity> getBrandList() {
        return brandMenuList;
    }

    public static SparseArray<GoodsMenuItemEntity> getPriceList() {
        SparseArray<GoodsMenuItemEntity> menuItemBeanList = new SparseArray<>();
        GoodsMenuItemEntity bean = new GoodsMenuItemEntity("1", "不排序", "");
        GoodsMenuItemEntity bean1 = new GoodsMenuItemEntity("2", "价格升序", "");
        GoodsMenuItemEntity bean2 = new GoodsMenuItemEntity("3", "价格降序", "");
        menuItemBeanList.put(0, bean);
        menuItemBeanList.put(1, bean1);
        menuItemBeanList.put(2, bean2);
        return menuItemBeanList;
    }

    public static List<String> getPriceSortList(){
        List<String> priceSorts=new ArrayList<>();
        priceSorts.add("不排序");
        priceSorts.add("价格升序");
        priceSorts.add("价格降序");
        return priceSorts;
    }
}
